<template>
	<view class="ys">
		<view class="no-list" v-if="list.length == 0">
			<image src="/static/index/nolist.png" mode="widthFix"></image>
			- 暂无数据 -
		</view>
		<view class="list" v-else>
			<view class="item" v-for="(item,index) in list" :key="index">
				<view class="info">
					<view class="name">
						房间 : {{item.roomOrder.room.name}}
					</view>
					<view class="phone">
						主管 : {{item.leader.name}} , 促销员 : {{item.staff.name}}
					</view>
					<view class="time">
						提交时间: {{item.create_time}}
					</view>
					<view class="time">
						<text>房间订单: {{item.roomOrder.create_time}} ~ {{item.roomOrder.finish_time || '未完成'}}</text>
					</view>
					<view class="content">
						<textarea :value="item.content" auto-height disabled></textarea>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getWatch
	} from "@/api/user.js"
	export default {
		data() {
			return {
				list: [],
				page: 1,
				last_page: 1
			}
		},
		onLoad() {
			this.page = 1
			this.last_page = 1
			this.getWatch()
		},
		onReachBottom() {
			if (this.page < this.last_page) {
				this.page++
				this.getWatch()
			}
		},
		methods: {
			getWatch() {
				getWatch({
					page: this.page
				}).then(res => {
					if (res.code == 0) {
						this.list = this.list.concat(res.data.data)
						this.last_page = res.data.last_page
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.add {
		position: fixed;
		z-index: 1005;
		right: 0;
		bottom: 10%;

		image {
			width: 40px;
			height: 40px;
		}
	}

	.list {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 15px 10px;
		box-sizing: border-box;
		flex-wrap: wrap;

		.item {
			background: #fff;
			border-radius: 6px;
			padding: 10px;
			box-sizing: border-box;
			width: 100%;
			margin-bottom: 15px;
			box-shadow: 0 0 5px #eee;
			display: flex;
			align-items: center;

			.imgbox {
				width: 60px;
				height: 60px;

				image {
					width: 100%;
					height: 100%;
				}
			}

			.btns {
				display: flex;
				justify-content: flex-end;
				width: 100px;

				button {
					font-size: 12px;
					margin: 0;
					padding: 0;
					width: 60px;
					background: #b60000;
					color: #fff;
				}
			}

			.info {
				width: calc(100%);
				box-sizing: border-box;

				.name {
					font-weight: bold;
					font-size: 14px;
					display: flex;
					align-items: center;

					text {
						margin-left: 10px;
						background: $uni-bg-color;
						font-size: 12px;
						color: #fff;
						padding: 2px 8px;
						border-radius: 4px;
					}
				}

				.phone {
					margin: 8px 0;
					font-size: 13px;
				}

				.time {
					color: #777;
					font-size: 13px;
					margin-top: 8px;
				}

				.content {
					margin-top: 10px;

					textarea {
						font-size: 14px;
						width: 100%;
						box-sizing: border-box;
					}
				}
			}
		}
	}
</style>